/* 
This do file counts the number of solar installations in each U.S. state by year.

NOTES: All directories and paths should be set in the main "Create_Number_Systems_Files.do" file.


*/

clear all

use `"${data_intermediate}/NumberSystems_year.dta"'

ds, has(type double float)
collapse (sum) `r(varlist)', by(state)
save `"${data_intermediate}/NumberSystems_year_state"', replace
export delimited using `"${data_intermediate}/NumberSystems_year_state.csv"', replace

drop if state=="AK" | state=="HI"
drop num_systems num_systems_1909 num_systems_1969 num_systems_1983 num_systems_1995 num_systems_1996 num_systems_1997 num_systems_1998 num_systems_1999
export excel using `"${scripts_subsidies}/Solar_Incentives_Data_no_severin_data.xlsx"', sheet("Num_systems") sheetmodify cell(A2) keepcellfmt